import timeit
from time import strftime, localtime, sleep

# import start_job
#
# if __name__ == '__main__':
#
#     while True:
#         now_hour = strftime("%H:%M", localtime())
#         if now_hour == "09:00":
#             start_job.start()
#         else:
#             sleep(30)
#             print(strftime('failed: %H:%M:%S', localtime()))
#             pass


import schedule
import time
import subprocess


def job():
    # 调用另一个Python脚本
    # 在服务器上面跑
    # subprocess.run(["D:\\scraping\pythonProject\\venv\\Scripts\\python.exe", "D:\\scraping\\pythonProject\\main\\main.py"])
    subprocess.run(["D:\Program Files\pythonEnvironment\python.exe", "D:\scraping\pythonProject\main\main.py"])


# 设置每天固定时间执行任务
schedule.every().day.at("07:30").do(job)

while True:
    schedule.run_pending()
    time.sleep(1)
